package com.zyong.design.pattern.mediator.case2;

/**
 * @program: zyong-design-pattern
 * @ClassName: AbstractColleague
 * @author: zyong
 * @create: 2024-04-02 23:58
 */
public abstract class AbstractColleague implements Colleague {
    private Mediator mediator;
    protected String name;

    public AbstractColleague(Mediator mediator, String name) {
        this.mediator = mediator;
        this.name = name;

        mediator.register(name, this);
    }

    /**
     * 获取中介者
     * @return
     */
    public Mediator getMediator() {
        return this.mediator;
    }
}
